package block;

import java.awt.Rectangle;

// Defines our falling blocks. Also, this is where I figured out what
// typecasting was :-)

public class yblock {

	private int x;
	private int y;
	private int width;
	private int height;
	private boolean visible;
	
	public yblock() {
    // Sigh... learning at its best ;-)
   
		/* Oooh lookie here:
		 * When we use the (something)(command) it returns the
		 * command in the (something) format! For instance, here
		 * we would normally get a double returned. Instead we get
		 * an int value!
		 */
	  
    // I cast as an int (round) because there are no .5 pixels. 
    x = (int)(Math.random() * 400); // Create a random x position.
   
		y = 10; // Set starting y position
		width = 30;
		height = 30;
		visible = true;
	}

  // Same as in other classes.
	public int getX() {
		return x;
	}
	
	public int getY() {
		return y;
	}
	
	public int getWidth() {
		return width;
	}
	
	public int getHeight() {
		return height;
	}
	
	public boolean isVisible() {
		return visible;
	}
	
	public void setVisible(boolean v) {
		visible = v;
	}
	
	
	public Rectangle getBounds() {
		return new Rectangle(x, y, width, height);
	}
	
	public void move() {
		y += 1;
	}
}
